package day1104;

import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.BiPredicate;

/**
 * @author Mr.ma
 * @since 2022/11/4 14:56
 * BiFunction：以BiFunction为例，这是一类在四个基本函数式接口的基础上进行扩展的一类函数式接口，
 *             可以传入两个参数，抽象方法与Function一致
 * 除Supplier外，有参的函数式接口都有Bi扩展
 * 方法引用
 **/
public class TestBiFunction {
    public static void main(String[] args) {
        BiFunction<Integer,Integer,Integer> biFunction = (o1,o2) -> o1-o2;
        Integer apply = biFunction.apply(19, 14);
        System.out.println("apply = " + apply);

        BiPredicate<String,String> biPredicate = String::equals;
        boolean test = biPredicate.test("hello", "hello");
        System.out.println("test = " + test);

        BiConsumer<String,String> biConsumer = (s1,s2)-> System.out.println("accept = " +s1 + " " + s2);
        biConsumer.accept("Hello", "World");
    }
}
